package model

import (
	"encoding/json"
	"time"

	"go.mongodb.org/mongo-driver/bson/primitive"
)

// RobotGroup  机器人分组
type RobotGroup struct {
	Id          primitive.ObjectID `json:"id" bson:"_id"`                       //id
	Name        string             `json:"name" bson:"name" binding:"required"` //分组名
	MapList     []string           `json:"map_list" bson:"map_list,omitempty"`  //绑定的地图名
	CreatedTime time.Time          `json:"-" bson:"created_time"`               //创建时间
	UpdateTime  time.Time          `json:"-" bson:"update_time"`                //开始时间
}

func (RobotGroup) TableName() string {
	return "t_data_robot_group"
}

func (robbotG *RobotGroup) MarshalJSON() ([]byte, error) {
	type Alias RobotGroup
	return json.Marshal(&struct {
		*Alias
		CreatedTime DateTime `json:"created_time"`
		UpdateTime  DateTime `json:"update_time"`
	}{
		Alias:       (*Alias)(robbotG),
		CreatedTime: DateTime(robbotG.CreatedTime),
		UpdateTime:  DateTime(robbotG.UpdateTime),
	})
}
